Skip to content

Fix float ghost default values - #539

Open
MohammedZaid1740 wants to merge 1 commit into
liquid-java:mainfrom
MohammedZaid1740:fix/float-ghost-default
Open

MohammedZaid1740 wants to merge 1 commit into
liquid-java:mainfrom
MohammedZaid1740:fix/float-ghost-default

Conversation

@MohammedZaid1740

Copy link
Copy Markdown

Description

Fixed the issue where declaring a float ghost caused the verifier to crash with the error "Ghost not implemented for type float".

Changes made:

  • Added 0.0 as the default value for float ghosts.
  • Added support for distinguishing 32-bit float from 64-bit double literals.
  • Updated Z3 translation to handle floating-point values with compatible precision.
  • Added a regression test for float ghost default values.

Example

import liquidjava.specification.Ghost;
import liquidjava.specification.StateRefinement;

@Ghost("float level")
class Tank {
    @StateRefinement(to = "true")
    public void fill() {}
}

A class with a float ghost can now be processed without the previous unsupported-type crash.

Related Issue

Closes #443

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Code refactoring

Checklist

  • Added/updated tests under liquidjava-example/src/main/java/testSuite/ (Correct* / Error*)
  • mvn test passes locally
  • Updated docs/README if behavior or API changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A float ghost crashes the verifier: "Ghost not implemented for type float"

1 participant